<?php
require_once 'database.php';
require_once 'common.php';

session_start();

//Get information from the post
$strTaskName = $_POST['task_name'];
$strTaskDesc = $_POST['task_description'];
$intEstimatedHours = $_POST['estimated_hours'];
$intTaskId = isset($_POST['task_id']) ? $_POST['task_id'] : 0;
$strStatus = $_POST['status'];
$intActualHours = $_POST['actual_hours'];

//Update the project
$dbResult = mysql_query("UPDATE task SET task_name='$strTaskName', task_description='$strTaskDesc',
		estimated_hours='$intEstimatedHours', actual_hours='$intActualHours', status='$strStatus' 
		WHERE task_id=$intTaskId");

$intRows = mysql_affected_rows();

$objReturn = array();

$objReturn['code'] = "SUCCESS";
$objReturn['task_id'] = $intTaskId;

header("content-type:application/json");
echo json_encode($objReturn);
